Optimal. Leaf size=55 \[ -\frac {a^2 x}{c}+\frac {i a^2 \log (\cos (e+f x))}{c f}-\frac {2 i a^2}{f (c-i c \tan (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3603, 3568, 45}
\begin {gather*} -\frac {2 i a^2}{f (c-i c \tan (e+f x))}+\frac {i a^2 \log (\cos (e+f x))}{c f}-\frac {a^2 x}{c} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 3568
Rule 3603
Rubi steps
\begin {align*} \int \frac {(a+i a \tan (e+f x))^2}{c-i c \tan (e+f x)} \, dx &=\left (a^2 c^2\right ) \int \frac {\sec ^4(e+f x)}{(c-i c \tan (e+f x))^3} \, dx\\ &=\frac {\left (i a^2\right ) \text {Subst}\left (\int \frac {c-x}{(c+x)^2} \, dx,x,-i c \tan (e+f x)\right )}{c f}\\ &=\frac {\left (i a^2\right ) \text {Subst}\left (\int \left (\frac {1}{-c-x}+\frac {2 c}{(c+x)^2}\right ) \, dx,x,-i c \tan (e+f x)\right )}{c f}\\ &=-\frac {a^2 x}{c}+\frac {i a^2 \log (\cos (e+f x))}{c f}-\frac {2 i a^2}{f (c-i c \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(130\) vs. \(2(55)=110\).
time = 0.85, size = 130, normalized size = 2.36 \begin {gather*} -\frac {a^2 \left (\cos (e+f x) \left (2 i+4 f x-i \log \left (\cos ^2(e+f x)\right )\right )-2 \text {ArcTan}(\tan (3 e+f x)) (\cos (e+f x)-i \sin (e+f x))+\left (-2-4 i f x-\log \left (\cos ^2(e+f x)\right )\right ) \sin (e+f x)\right ) (\cos (e+3 f x)+i \sin (e+3 f x))}{2 c f (\cos (f x)+i \sin (f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.16, size = 38, normalized size = 0.69
method | result | size |
derivativedivides | \(\frac {a^{2} \left (\frac {2}{\tan \left (f x +e \right )+i}-i \ln \left (\tan \left (f x +e \right )+i\right )\right )}{f c}\) | \(38\) |
default | \(\frac {a^{2} \left (\frac {2}{\tan \left (f x +e \right )+i}-i \ln \left (\tan \left (f x +e \right )+i\right )\right )}{f c}\) | \(38\) |
risch | \(-\frac {i a^{2} {\mathrm e}^{2 i \left (f x +e \right )}}{c f}+\frac {2 a^{2} e}{c f}+\frac {i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{c f}\) | \(59\) |
norman | \(\frac {-\frac {2 i a^{2}}{c f}-\frac {a^{2} x}{c}-\frac {a^{2} x \left (\tan ^{2}\left (f x +e \right )\right )}{c}+\frac {2 a^{2} \tan \left (f x +e \right )}{c f}}{1+\tan ^{2}\left (f x +e \right )}-\frac {i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 c f}\) | \(94\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.23, size = 41, normalized size = 0.75 \begin {gather*} \frac {-i \, a^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, a^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{c f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.19, size = 68, normalized size = 1.24 \begin {gather*} \frac {i a^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c f} + \begin {cases} - \frac {i a^{2} e^{2 i e} e^{2 i f x}}{c f} & \text {for}\: c f \neq 0 \\\frac {2 a^{2} x e^{2 i e}}{c} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 125 vs. \(2 (51) = 102\).
time = 0.52, size = 125, normalized size = 2.27 \begin {gather*} -\frac {-\frac {i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{c} + \frac {2 i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c} - \frac {i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{c} + \frac {-3 i \, a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 \, a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 3 i \, a^{2}}{c {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.68, size = 45, normalized size = 0.82 \begin {gather*} \frac {2\,a^2}{c\,f\,\left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )}-\frac {a^2\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{c\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________